package com.tianyouxiu.springai.controller;

import com.tianyouxiu.springai.repository.ChatHistoryRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/ai/history")
public class ChatHistoryController {

  private final ChatHistoryRepository chatHistoryRepository;

  @GetMapping("/chatHistory/{type}")
  public List<String> chatHistory(@PathVariable("type") String type) {
    return chatHistoryRepository.getChatIds(type);
  }
}
